﻿using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace UIModule.Views
{
    /// <summary>
    /// Analysis20240725.xaml 的交互逻辑
    /// </summary>
    public partial class Analysis20240725 : UserControl
    {
        public Analysis20240725()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {

        }

        private void BtnSecondary_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            var btn = sender as System.Windows.Controls.Button;
            btn.Background = new SolidColorBrush(Color.FromRgb(0xF1, 0xF0, 0xF5));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSecondary_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            var btn = sender as System.Windows.Controls.Button;
            btn.Background = new SolidColorBrush(Colors.Transparent);
        }

        private void datePicker_Start_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            var start = datePicker_Start.SelectedDate;

            if (start.HasValue)
            {
                this.datePicker_End.BlackoutDates.Clear();
                this.datePicker_End.BlackoutDates.Add(new CalendarDateRange(DateTime.MinValue, start.Value.AddDays(-1)));
            }
            else
            {
                this.datePicker_End.BlackoutDates.Clear();
            }

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void datePicker_End_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            var end = datePicker_End.SelectedDate;

            if (end.HasValue)
            {

                this.datePicker_Start.BlackoutDates.Add(new CalendarDateRange(end.Value.AddDays(1), DateTime.MaxValue));
            }
            else
            {
                this.datePicker_Start.BlackoutDates.Clear();
            }
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="navigationContext"></param>
        public void OnNavigatedTo(NavigationContext navigationContext)
        {


        }

        public bool IsNavigationTarget(NavigationContext navigationContext)
        {
            return true;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="navigationContext"></param>

        public void OnNavigatedFrom(NavigationContext navigationContext)
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSearch_Click(object sender, RoutedEventArgs e)
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnReset_Click(object sender, RoutedEventArgs e)
        {

        }
    }
}
